//
// Created by tacom on 2024/9/26.
//

#ifndef PICO_USB_HOST_DEMO_SPI_TRANSFER_H
#define PICO_USB_HOST_DEMO_SPI_TRANSFER_H

#include "stdio.h"
#include "hardware/spi.h"
#include "pico/stdlib.h"


/**         define         **/
// 1Mb
#define SPI_SPEED 500000
// 256 Byte
#define BUF_LEN 256

#ifdef __cplusplus
extern "C" {
#endif

/**         variable        **/
extern uint8_t out_buf[BUF_LEN], in_buf[BUF_LEN];

/**          function       **/
void spi_slave_init();
int spi_slave_transfer_data(bool to_host, size_t len);
void spi_slave_transfer_with_dma(bool to_host, size_t len);
void spi_loop_dma_test();

#ifdef __cplusplus
}
#endif

#endif //PICO_USB_HOST_DEMO_SPI_TRANSFER_H
